package beans {

	public class HireBean {
		
		//------------------------------------------------------------
		//
		// variables
		//
		//------------------------------------------------------------
		
		//------------------------------
		// speciality
		//------------------------------

		private var _speciality:String;

		public function get speciality():String {
			return _speciality;
		}

		public function set speciality(speciality:String):void {
			_speciality = speciality;
		}

		//------------------------------
		// count
		//------------------------------

		private var _count:int;

		public function get count():int {
			return _count;
		}

		public function set count(count:int):void {
			_count = count;
		}

		//------------------------------
		// condition
		//------------------------------

		private var _condition:String;

		public function get condition():String {
			return _condition;
		}

		public function set condition(condition:String):void {
			_condition = condition;
		}

		//------------------------------------------------------------
		//
		// constructor
		//
		//------------------------------------------------------------

		public function HireBean(value:XML) {
			if (!value) {
				speciality = "";
				count = 1;
				condition = "";
				return;
			}
			
			speciality = value.speciality;
			count = int(value.count);
			condition = value.condition;
		}

		/**
		 * represent this object as a xml object
		 * @return xml object
		 */
		public function toXML():XML {
			var hireInfoNode:XML = <hireInfo/>;
			
			var specialityNode:XML = <speciality>{speciality}</speciality>;
			hireInfoNode.appendChild(specialityNode);
			
			var countNode:XML = <count>{count}</count>;
			hireInfoNode.appendChild(countNode);
			
			var conditionNode:XML = <condition>{condition}</condition>;
			hireInfoNode.appendChild(conditionNode);
			
			return hireInfoNode;
		}
		
	}
}